package yh;

/**
 * 已知数组int[] arr1={1,3,5,7,9},int[] arr2;
 * 将数组arr1的内容复制到数组arr2中
 */
public class ArrayTest3 {
    public static void main(String[] args) {
        //1.定义数组
        int[] arr1,arr2;
        //2.初始化
        arr1=new int[]{1,3,5,7,9};
        //3.打印数组arr1
        for (int i = 0; i <arr1.length ; i++) {
            System.out.println(arr1[i]);
        }
        //4.数组复制操作
        arr2=new int[arr1.length];
        for (int i = 0; i <arr1.length ; i++) {
            arr2[i]=arr1[i];
            System.out.println(arr2[i]);
        }
    }
}
